﻿Imports SdlDotNet.Graphics

Public Class CommonSurfaces
    Private Shared _instance As CommonSurfaces

    Public ReadOnly NuclearExplosionSurfaces As New SurfaceCollection()
    Public ReadOnly ExplosionSurfaces As New SurfaceCollection()
    Public ReadOnly PopulationMigrationMovingRightSurfaces As New SurfaceCollection()
    Public ReadOnly PopulationMigrationMovingLeftSurfaces As New SurfaceCollection()

    Protected Sub New()
        InitializeNuclearExplosion()
        InitializeExplosion()
        InitializePopulationMigration()
    End Sub

    Private Sub InitializePopulationMigration()
        For i As Integer = 1 To 4
            Dim rightSurface As New Surface("Resources\images\game\PopulationMigration_" & i & ".png")
            PopulationMigrationMovingRightSurfaces.Add(rightSurface)
            PopulationMigrationMovingLeftSurfaces.Add(rightSurface.CreateFlippedHorizontalSurface())
        Next
    End Sub

    Private Sub InitializeExplosion()
        For i As Integer = 1 To 6
            ExplosionSurfaces.Add(New Surface("Resources\images\game\Explosion_" & i & ".png"))
        Next
    End Sub

    Private Sub InitializeNuclearExplosion()
        For i As Integer = 1 To 27
            NuclearExplosionSurfaces.Add(New Surface("Resources\images\game\NuclearExplosion_" & i & ".png"))
        Next
    End Sub

    Public Shared Function Instance() As CommonSurfaces
        If _instance Is Nothing Then
            _instance = New CommonSurfaces()
        End If
        Return _instance
    End Function
End Class
